package com.px.service;

import com.px.client.ShCommentFeignClient;
import com.px.pojo.ShComment;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ShCommentServiceImpl implements ShCommentService {

    @Resource
    private ShCommentFeignClient shCommentFeignClient;

    @Override
    public List<ShComment> selectShCommentList(Integer commentType, Integer commodityId, Integer userId, Integer currentPageNo, Integer pageSize) throws Exception {
        Integer offSet = (currentPageNo-1)*pageSize;
        return shCommentFeignClient.selectShCommentList(commentType,commodityId,userId,offSet,pageSize);
    }

    @Override
    public int selectShCommentCount(Integer commentType, Integer commodityId, Integer userId) throws Exception {
        return shCommentFeignClient.selectShCommentCount(commentType,commodityId,userId);
    }

    @Override
    public ShComment selectShComment(Integer commentId) throws Exception {
        return shCommentFeignClient.selectShComment(commentId);
    }

    @Override
    public int insertShComment(ShComment shComment) throws Exception {
        return shCommentFeignClient.insertShComment(shComment);
    }

    @Override
    public int updateShComment(ShComment shComment) throws Exception {
        return shCommentFeignClient.updateShComment(shComment);
    }

    @Override
    public int deleteShComment(Integer id) throws Exception {
        return shCommentFeignClient.deleteShComment(id);
    }
}
